/**
 * Copyright (c) 2011-2014, James Zhan 詹波 (jfinal@126.com).
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 */

package com.jfinal.qyweixin.sdk.api;

import java.util.HashMap;
import java.util.Map;

/**
 * 微信接口全局返回码
 */
public class ReturnCode {
	
    @SuppressWarnings("serial")
	private static final Map<Integer, String> errCodeToErrMsg = new HashMap<Integer, String>(){{
		put(-1,"系统繁忙");
		put(0,"请求成功");
		put(40001,"不合法的secret参数");
		put(40003,"无效的UserID");
		put(40004,"不合法的媒体文件类型");
		put(40005,"不合法的type参数");
		put(40006,"不合法的文件大小");
		put(40007,"不合法的media_id参数");
		put(40008,"不合法的msgtype参数");
		put(40009,"上传图片大小不是有效值");
		put(40011,"上传视频大小不是有效值");
		put(40013,"不合法的CorpID");
		put(40014,"不合法的access_token");
		put(40016,"不合法的按钮个数");
		put(40017,"不合法的按钮类型");
		put(40018,"不合法的按钮名字长度");
		put(40019,"不合法的按钮KEY长度");
		put(40020,"不合法的按钮URL长度");
		put(40022,"不合法的子菜单级数");
		put(40023,"不合法的子菜单按钮个数");
		put(40024,"不合法的子菜单按钮类型");
		put(40025,"不合法的子菜单按钮名字长度");
		put(40026,"不合法的子菜单按钮KEY长度");
		put(40027,"不合法的子菜单按钮URL长度");
		put(40029,"不合法的oauth_code");
		put(40031,"不合法的UserID列表");
		put(40032,"不合法的UserID列表长度");
		put(40033,"不合法的请求字符");
		put(40035,"不合法的参数");
		put(40050,"chatid不存在");
		put(40054,"不合法的子菜单url域名");
		put(40055,"不合法的菜单url域名");
		put(40056,"不合法的agentid");
		put(40057,"不合法的callbackurl或者callbackurl验证失败");
		put(40058,"不合法的参数");
		put(40059,"不合法的上报地理位置标志位");
		put(40063,"参数为空");
		put(40066,"不合法的部门列表");
		put(40068,"不合法的标签ID");
		put(40070,"指定的标签范围结点全部无效");
		put(40071,"不合法的标签名字");
		put(40072,"不合法的标签名字长度");
		put(40073,"不合法的openid");
		put(40074,"news消息不支持保密消息类型");
		put(40077,"不合法的pre_auth_code参数");
		put(40078,"不合法的auth_code参数");
		put(40080,"不合法的suite_secret");
		put(40082,"不合法的suite_token");
		put(40083,"不合法的suite_id");
		put(40084,"不合法的permanent_code参数");
		put(40085,"不合法的的suite_ticket参数");
		put(40086,"不合法的第三方应用appid");
		put(40088,"jobid不存在");
		put(40089,"批量任务的结果已清理");
		put(40091,"secret不合法");
		put(40092,"导入文件存在不合法的内容");
		put(40093,"不合法的jsapi_ticket参数");
		put(40094,"不合法的URL");
		put(40096,"不合法的外部联系人userid");
		put(40097,"该成员尚未离职");
		put(40098,"接替成员尚未实名认证");
		put(40099,"接替成员的外部联系人数量已达上限");
		put(40100,"此用户的外部联系人已经在转移流程中");
		put(41001,"缺少access_token参数");
		put(41002,"缺少corpid参数");
		put(41004,"缺少secret参数");
		put(41006,"缺少media_id参数");
		put(41008,"缺少authcode参数");
		put(41009,"缺少userid参数");
		put(41010,"缺少url参数");
		put(41011,"缺少agentid参数");
		put(41033,"缺少description参数");
		put(41035,"缺少外部联系人userid参数");
		put(41016,"缺少title参数");
		put(41019,"缺少department参数");
		put(41017,"缺少tagid参数");
		put(41021,"缺少suite_id参数");
		put(41022,"缺少suite_access_token参数");
		put(41023,"缺少suite_ticket参数");
		put(41024,"缺少secret参数");
		put(41025,"缺少permanent_code参数");
		put(42001,"access_token已过期");
		put(42007,"pre_auth_code已过期");
		put(42009,"suite_access_token已过期");
		put(43004,"指定的userid未绑定微信或未关注微工作台（原企业号）");
		put(44001,"多媒体文件为空");
		put(44004,"文本消息content参数为空");
		put(45001,"多媒体文件大小超过限制");
		put(45002,"消息内容大小超过限制");
		put(45004,"应用description参数长度不符合系统限制");
		put(45007,"语音播放时间超过限制");
		put(45008,"图文消息的文章数量不符合系统限制");
		put(45009,"接口调用超过限制");
		put(45022,"应用name参数长度不符合系统限制");
		put(45024,"帐号数量超过上限");
		put(45026,"触发删除用户数的保护");
		put(45032,"图文消息author参数长度超过限制");
		put(45033,"接口并发调用超过限制");
		put(46003,"菜单未设置");
		put(46004,"指定的用户不存在");
		put(48002,"API接口无权限调用");
		put(48003,"不合法的suite_id");
		put(48004,"授权关系无效");
		put(48005,"API接口已废弃");
		put(50001,"redirect_url未登记可信域名");
		put(50002,"成员不在权限范围");
		put(50003,"应用已禁用");
		put(60001,"部门长度不符合限制");
		put(60003,"部门ID不存在");
		put(60004,"父部门不存在");
		put(60005,"部门下存在成员");
		put(60006,"部门下存在子部门");
		put(60007,"不允许删除根部门");
		put(60008,"部门已存在");
		put(60009,"部门名称含有非法字符");
		put(60010,"部门存在循环关系");
		put(60011,"指定的成员/部门/标签参数无权限");
		put(60012,"不允许删除默认应用");
		put(60020,"访问ip不在白名单之中");
		put(60028,"不允许修改第三方应用的主页URL");
		put(60102,"UserID已存在");
		put(60103,"手机号码不合法");
		put(60104,"手机号码已存在");
		put(60105,"邮箱不合法");
		put(60106,"邮箱已存在");
		put(60107,"微信号不合法");
		put(60110,"用户所属部门数量超过限制");
		put(60111,"UserID不存在");
		put(60112,"成员name参数不合法");
		put(60123,"无效的部门id");
		put(60124,"无效的父部门id");
		put(60125,"非法部门名字");
		put(60127,"缺少department参数");
		put(60129,"成员手机和邮箱都为空");
		put(72023,"发票已被其他公众号锁定");
		put(72024,"发票状态错误");
		put(72037,"存在发票不属于该用户");
		put(80001,"可信域名不正确，或者无ICP备案");
		put(81001,"部门下的结点数超过限制（3W）");
		put(81002,"部门最多15层");
		put(81011,"无权限操作标签");
		put(81013,"UserID、部门ID、标签ID全部非法或无权限");
		put(81014,"标签添加成员，单次添加user或party过多");
		put(82001,"指定的成员/部门/标签全部无效");
		put(82002,"不合法的PartyID列表长度");
		put(82003,"不合法的TagID列表长度");
		put(84014,"成员票据过期");
		put(84015,"成员票据无效");
		put(84019,"缺少templateid参数");
		put(84020,"templateid不存在");
		put(84021,"缺少register_code参数");
		put(84022,"无效的register_code参数");
		put(84023,"不允许调用设置通讯录同步完成接口");
		put(84024,"无注册信息");
		put(84025,"不符合的state参数");
		put(84052,"缺少caller参数");
		put(84053,"缺少callee参数");
		put(84054,"缺少auth_corpid参数");
		put(84055,"超过拨打公费电话频率");
		put(84056,"被拨打用户安装应用时未授权拨打公费电话权限");
		put(84057,"公费电话余额不足");
		put(84058,"caller呼叫号码不支持");
		put(84059,"号码非法");
		put(84060,"callee呼叫号码不支持");
		put(84061,"不存在外部联系人的关系");
		put(84062,"未开启公费电话应用");
		put(84063,"caller不存在");
		put(84064,"callee不存在");
		put(84065,"caller跟callee电话号码一致");
		put(84066,"服务商拨打次数超过限制");
		put(84067,"管理员收到的服务商公费电话个数超过限制");
		put(84071,"不合法的外部联系人授权码");
		put(84072,"应用未配置客服");
		put(84073,"客服userid不在应用配置的客服列表中");
		put(84074,"没有外部联系人权限");
		put(85002,"包含不合法的词语");
		put(85004,"每企业每个月设置的可信域名不可超过20个");
		put(85005,"可信域名未通过所有权校验");
		put(86001,"参数chatid不合法");
		put(86003,"参数chatid不存在");
		put(86004,"参数群名不合法");
		put(86005,"参数群主不合法");
		put(86006,"群成员数过多或过少");
		put(86007,"不合法的群成员");
		put(86008,"非法操作非自己创建的群");
		put(86101,"仅群主才有操作权限");
		put(86201,"参数需要chatid");
		put(86202,"参数需要群名");
		put(86203,"参数需要群主");
		put(86204,"参数需要群成员");
		put(86205,"参数字符串chatid过长");
		put(86206,"参数数字chatid过大");
		put(86207,"群主不在群成员列表");
		put(86215,"会话ID已经存在");
		put(86216,"存在非法会话成员ID");
		put(86217,"会话发送者不在会话成员列表中");
		put(86220,"指定的会话参数不合法");
		put(90001,"未认证摇一摇周边");
		put(90002,"缺少摇一摇周边ticket参数");
		put(90003,"摇一摇周边ticket参数不合法");
		put(90100,"非法的对外属性类型");
		put(90101,"对外属性：文本类型长度不合法");
		put(90102,"对外属性：网页类型标题长度不合法");
		put(90103,"对外属性：网页url不合法");
		put(90104,"对外属性：小程序类型标题长度不合法");
		put(90105,"对外属性：小程序类型pagepath不合法");
		put(90106,"对外属性：请求参数不合法");
		put(91040,"获取ticket的类型无效");
		put(301002,"无权限操作指定的应用");
		put(301005,"不允许删除创建者");
		put(301012,"参数position不合法");
		put(301013,"参数telephone不合法");
		put(301014,"参数english_name不合法");
		put(301015,"参数mediaid不合法");
		put(301016,"上传语音文件不符合系统要求");
		put(301017,"上传语音文件仅支持AMR格式");
		put(301021,"参数userid无效");
		put(301022,"获取打卡数据失败");
		put(301023,"useridlist非法或超过限额");
		put(301024,"获取打卡记录时间间隔超限");
		put(301036,"不允许更新该用户的userid");
		put(302003,"批量导入任务的文件中userid有重复");
		put(302004,"组织架构不合法（1不是一棵树，2多个一样的partyid，3partyid空，4partyidname空，5同一个父节点下有两个子节点部门名字一样可能是以上情况，请一一排查）");
		put(302005,"批量导入系统失败，请重新尝试导入");
		put(302006,"批量导入任务的文件中partyid有重复");
		put(302007,"批量导入任务的文件中，同一个部门下有两个子部门名字一样");
		put(2000002,"CorpId参数无效");
    }};
    
    /**
     * 通过返回码获取返回信息
     */
    public static String get(int errCode){
    	String result = errCodeToErrMsg.get(errCode);
    	return result !=null? result : "未知返回码：" + errCode;
    }
}




